package com.wide.core.shared.json;

import java.util.TreeMap;

public class JsonObject extends TreeMap<String, JsonValue> implements JsonValue {
	private static final long serialVersionUID = 1L;

	@Override
	public boolean isBoolean() {
		return false;
	}

	@Override
	public boolean isString() {
		return false;
	}

	@Override
	public boolean isNumber() {
		return false;
	}

	@Override
	public boolean isObject() {
		return true;
	}

	@Override
	public boolean isArray() {
		return false;
	}

	@Override
	public boolean isNull() {
		return false;
	}

	public String toString() {
		boolean first = true;
		String stringVal = "{";
		for (String key : this.keySet()) {
			if (!first) {
				stringVal += ", ";
			}
			
			stringVal += "\"" + key + "\": " + this.get(key).toString();
			first = false;
		}
		stringVal += "}";
		
		return stringVal;
	}
}
